<template>
	<div>
		<!-- 无子级 -->  
		<!-- 注:item.url == 传过来的 path -->
		<el-menu-item :index="item.url" v-if="!item.child">
			<i v-if="item.icon" :class="item.icon"></i>
			<i v-else style="margin-right: 10px;"></i>
			<span>{{item.name}}</span>
		</el-menu-item>
		
		<!-- 有子级 -->
		<el-submenu :index="path" v-else>
			<template slot="title">
				<i v-if="item.icon" :class="item.icon"></i>
				<i v-else style="margin-right: 10px;"></i>
				<span>{{item.name}}</span>
			</template>
			<NavItem v-for="(child,index) in item.child" :key="index" :item="child" :path="child.url" />
		</el-submenu>
	</div>
</template>

<script>
export default {
	name: 'NavItem',
	data() {
		return {
			
		};
	},
	props:['item','path'],//父传子参数
	components: {},
	created() {},
	mounted() {},
	methods: {
		
	}
};
</script>
<style>

</style>
